package org.spring.demo.service.impl;

import javax.annotation.Resource;

import org.spring.demo.dao.UserDao;
import org.spring.demo.model.User;
import org.spring.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(readOnly=true)
public class UserServiceImpl implements UserService{


	private UserDao userDao;
	
	@Autowired
	public void setUserDao(UserDao userDao) {
		//log
		this.userDao = userDao;
	}

	@Override
	@Transactional(readOnly=false)
	public void addUser(String account, String password) {
		// 省略其他逻辑... 
		User user=new User(account, password);
		userDao.addUser(user);
	}
	
	@Override
	public User findUserByAccount(String account) {
		User user = userDao.findUserByAccount(account);
		
		return user;
	}


}
